Import jmd.rad

Local velY:Float = 0.001
Local gravityForce:Float = -0.5
Local posY:Float = 0
Local ballDiameter:Int = 50

Graphics 640,480

While Not KeyDown(KEY_ESCAPE)
	
	
	If velY<>0
	'calculate gravity forces
	velY:- gravityForce
	'add acceleration to postion
	posY:+ velY
	EndIf
	
	'Rebound!
	If posY>GraphicsHeight()-ballDiameter
		velY=Rebound(velY,0.75,0.1)
	EndIf
	
	'Reset?
	If KeyHit(KEY_R)
		posY=0
		velY=0.001
	EndIf
	
	'Draw it
	Cls
	DrawText "Press R to reset",10,10
	DrawOval GraphicsWidth()/2,posY,ballDiameter,ballDiameter
	Flip

Wend
